import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";

export type AqiGradeType = {
  code: number;
  message: string;
  data: {
    list: {
      aqiId: number;
      aqiLevel: number;
      aqiLevelDes: string;
      aqiColor: string;
      aqiHealthImpact: string;
      aqiTakeMeasure: string;
    };
  };
};

/**根据aqi等级获取aqi */
export const getAqiGradeByLevel = (aqiLevel: number) => {
  return http.request<AqiGradeType>(
    "get",
    baseUrlApi("/result/aqigrade/getAqiGradeByLevel"),
    {
      params: {
        aqiLevel: aqiLevel
      }
    }
  );
};

export const listAqiGrades = () => {
  return http.request<AqiGradeType>(
    "post",
    baseUrlApi("/result/aqigrade/getAqiGrades")
  );
};
